import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "@/views/Layout/index.vue";
//安装路由，显示引用
Vue.use(VueRouter);

//配置导出路由
export const routes = [
  {
    path: "/",
    component: Layout,
    redirect: "/home",
    children: [
      {
        path: "home",
        name: "home",
        component: () => import("@/views/Home/index.vue"),
        meta: { title: "首页", menuType: 1 },
      },
      {
        path: "vueStudy",
        name: "vueStudy",
        meta: { title: "Vue相关知识", menuType: 1, img: "vue" },
        component: { render: (h) => h("router-view") },
        redirect: "/vueStudy/vueComponentCommunication",
        children: [
          {
            path: "vueComponentCommunication",
            name: "vueComponentCommunication",
            component: () =>
              import("../views/vueStudy/vueComponentCommunication/index.vue"),
            meta: { title: "Vue组件通讯", menuType: 2 },
          },
          {
            path: "mixin",
            name: "mixin",
            component: () => import("../views/vueStudy/mixin/index.vue"),
            meta: { title: "Vue 混入", menuType: 2 },
          },
        ],
      },
    ],
  },
  {
    path: "/:catchA1l(.*)",
    name: "404",
    meta: { hidden: true, menuType: 1 },
    component: () =>
      import(/* webpackChunkName: "error" */ "../views/error/index.vue"),
  },
];
export default new VueRouter({
  mode: "history",
  routes,
});
